home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume10 / cbw / part03 < prev    next >
Encoding:
Internet Message Format  |  1987-06-16  |  51.3 KB

  1. Path: seismo!uunet!rs
  2. From: rs@uunet.UU.NET (Rich Salz)
  3. Newsgroups: comp.sources.unix
  4. Subject: v10i003:  Crypt Breaker's Workbench, Part03/11
  5. Message-ID: <375@uunet.UU.NET>
  6. Date: 17 Jun 87 22:40:03 GMT
  7. Organization: UUNET Communications Services, Arlington, VA
  8. Lines: 2404
  9. Approved: rs@uunet.uu.net
  10.  
  11. Submitted by: Robert W. Baldwin <BALDWIN@XX.LCS.MIT.EDU>
  12. Mod.sources: Volume 10, Issue 3
  13. Archive-name: cbw/Part03
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 3 (of 11)."
  22. # Contents:  UU.test2 cbw.log mss-bigram.stats pword.c screen.c
  23. #   tdriver.c test1.txt window.h
  24. # Wrapped by rs@uunet on Wed Jun 17 18:17:10 1987
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f UU.test2 -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"UU.test2\"
  28. else
  29. echo shar: Extracting \"UU.test2\" \(5977 characters\)
  30. sed "s/^X//" >UU.test2 <<'END_OF_UU.test2'
  31. Xbegin 644 test2.cipher
  32. XM1'&`=V[P=-\_@(BE.Z.<"HG/_;^M8!^QSO@`J4MNJY\21BB@3F9IH:3$H.OR
  33. XMDTWP*'E)?K;:BI4^JL.H-4B_ZAR?3Q2?,1(/X=X,#+3ZH0<*4#HZGS54.D2-
  34. XM`$;Z?=6[(6"-?\#2^(1H?[IOC?3#8O!?!Y9EF77<8>"])Y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O=[\&?@[+[*+K?,D^
  113. XM!H`*#&%R&04@1;V[1]'0V_SFM.X_!B1\_94.#$G23/X[C8.>?`B,H@0R"S`0
  114. XMS6;+LB5?0A_%X07?DPD46<Q_"503)VYZFI*1EV-9\EE^#%VYWRU1JZK+94M+
  115. XM=TF/(F1(#$+-]QN&LD3CQL2"M:)]/&.MZF@J*7]R4LP/<LEXZK2S?ZO!PS,K
  116. XM3FU0N#A<\_C"P6?E]F!$;MQ@8H!99[0O..Y!'"`&?@W@)2DH?DC'56=05\Q7
  117. XMP'&Y6=87R#+\KY_C16A#B_W-1J*&FC'!3.(VVS1&6$2-.-_[+M8]AA>=]%![
  118. XM12YQ7)<>W#0TO7585_G.9<%57DDC;6NG!`/3DFT64E'+CNY-QYGV%^.,PM8X
  119. XM9&;.N]9UF@]?)S,ER`8N>BT)@M=-R-746_C;^%=/;LS[G=BBQX03)/D4:<B\
  120. XM"7(NP4+'!H4H60RT5++?KWY1F.T<XM\GTI$>!NH;@KKVY27\<OV`8%_B[D47
  121. XM>$<'!G^N>#:RC61J;&)JCIDW8FOU`X<,P%L1CK+_#H&@,.3=\/RC-C6:)_[U
  122. XM\IM;753,T=(6]@HN4\H=FQL@W*!6CYZXG/8/:`T=LPH)?P<7\P1X=P"S>SL`
  123. XMOIZLC<"5"QO!"QB8HACS$1/1G,3\K]W<"-KU;^0%J5N>3S!P;[0OP6XU%A4;
  124. XM>).][#3=N?9(8%\I-_`CA+G!(#V\NQ,$K&=X0P2$L@HSY30S*_NH"],L)F/0
  125. XM][KFV.1_@+1+W\1'"?L7%GL1:K!6LPQ`#7(89V!?#:9QMCQNLSEK0<B("9&0
  126. XMQ6."4\R_-8R'BGKS#XJC/NZG<0Z+G#O,4$].R:V+L5>?FT9;&R&PK_?R3RB!
  127. XIJ4T3R-\0.T6>,^B\N3^:RW!B89UH*=6`&07I85?6`?)M#D40*\S1^_/R
  128. X`
  129. Xend
  130. END_OF_UU.test2
  131. if test 5977 -ne `wc -c <UU.test2`; then
  132.     echo shar: \"UU.test2\" unpacked with wrong size!
  133. fi
  134. # end of overwriting check
  135. fi
  136. if test -f cbw.log -a "${1}" != "-c" ; then 
  137.   echo shar: Will not over-write existing file \"cbw.log\"
  138. else
  139. echo shar: Extracting \"cbw.log\" \(4985 characters\)
  140. sed "s/^X//" >cbw.log <<'END_OF_cbw.log'
  141. X
  142. XWho:   Bob Baldwin
  143. XWhy:   
  144. XWhen:  6/16/85
  145. XWhat:  
  146. X
  147. X
  148. X
  149. XWho:   Bob Baldwin
  150. XWhy:   Had to learn about terminal independence sometime.
  151. XWhen:  10/8/86
  152. XWhat:  
  153. X- Change outline of lookup window to use graphics.
  154. X- Change graphics bit to 128 from 256.
  155. X- Change screen plstring to check graphics bit.
  156. X- The dictionary file found via a shell variable DICTIONARY.
  157. X  - Defaults to /usr/dict/words.
  158. X- Require that all control characters except \n and \t be
  159. X  quoted before they are inserted into the block.
  160. X  - Note problem with making C-Q or C-S active.
  161. X- Avoid the disperr() routine until the screen is initialized.
  162. X  - This fixes problems caused when termcap doesn't specify screen size.
  163. X  --> Don't avoid, just fix disperr not to call setcursor().
  164. X- Send init term sequence to terminal (if any).
  165. X- Speed up the graphic printing by remembering whether the term
  166. X  is in graphics mode.
  167. X- Fix bug that allowed the cursor to move off the screen, which caused
  168. X  the program to exit.
  169. X  - Force screen size to 24 x 80.
  170. X  - Change go_down behavior in user window.
  171. X- Have the PF4 key jump the cursor to the command line (if any).
  172. X  - Have C-X also do this.
  173. X- Fix formatting problems due to 4 char tab versus 8 char tab bug.
  174. X- Send sequence to active keypad.
  175. X- Have C-Z abort the current command (what about C-C?).
  176. X- Add a command to suspend the program and return to the shell.
  177. X  - This avoids the long wait on reading stats.
  178. X- In general need to provide a way to re-init terminal when
  179. X  program is exited and entered.
  180. X- Get the PF key definitions from the termcaps file.
  181. X- Add general keymap which can handle long sequences generated
  182. X  by a single keystroke.
  183. X- Init keymap from shell variable.
  184. X- Add graphics character map.
  185. X- Init from defaults and shell variable.
  186. X
  187. X
  188. XWho:   Bob Baldwin
  189. XWhy:   Remove references to buggy word lookup features.
  190. XWhen:  6/16/85
  191. XWhat:  dbsaux.c
  192. X
  193. XWho:   Bob Baldwin
  194. XWhy:   Make start up faster.
  195. XWhen:  1/15/86
  196. XWhat:  stats.c
  197. X
  198. XWho:   Bob Baldwin
  199. XWhy:   More work on word lookup.
  200. XWhen:  6/16/85
  201. XWhat:  specs.h, lpair.c, dbsaux.c, webster.c
  202. X
  203. XWho:   Bob Baldwin
  204. XWhy:   Fix formatting.
  205. XWhen:  6/13/85
  206. XWhat:  cipher.h
  207. X
  208. XWho:   Bob Baldwin
  209. XWhy:   Add word lookup cmd to dblock. (^S)
  210. XWhen:  6/13/85
  211. XWhat:  dblock.c, dbsaux.c, webster.c, window.h, specs.h
  212. X
  213. XWho:   Bob Baldwin
  214. XWhy:   Make ^T use bigram stats.
  215. XWhen:  5/11/85
  216. XWhat:  dbsaux.c
  217. X
  218. XWho:   Bob Baldwin
  219. XWhy:   Fix decryption block help message to indicate ^L and ^G.
  220. XWhen:  5/11/85
  221. XWhat:  dblock.c
  222. X
  223. XWho:   Bob Baldwin
  224. XWhy:   Added routine to clear guess window, gbsclear().
  225. XWhen:  5/11/85
  226. XWhat:  gblock.c
  227. X
  228. XWho:   Bob Baldwin
  229. XWhy:   Integrate bigram guessing into cbw.
  230. XWhen:  5/11/85
  231. XWhat:  user.c, specs.h
  232. X
  233. XWho:   Bob Baldwin
  234. XWhy:   Add fast approx for sqrt and exp.
  235. XWhen:  5/11/85
  236. XWhat:  approx.c
  237. X
  238. XWho:   Bob Baldwin
  239. XWhy:   Try bigram equiv class guessing strategies.
  240. XWhen:  5/2/85
  241. XWhat:  lpair.c, cipher.h
  242. X
  243. XWho:   Bob Baldwin
  244. XWhy:   Add bigram statistics.
  245. XWhen:  4/28/85
  246. XWhat:  stats.c, bdriver.c, specs.h, cipher.h
  247. X
  248. XWho:   Bob Baldwin
  249. XWhy:   Add new scoring alg based on prob sample drawn from english.
  250. XWhen:  3/3/85
  251. XWhat:  stats.c, sdriver.c, specs.h
  252. X
  253. XWho:   Bob Baldwin
  254. XWhy:   Make merge only show changes.
  255. XWhen:  2/15/85
  256. XWhat:  dblock.c
  257. X
  258. XWho:   Bob Baldwin
  259. XWhy:   Fix duplicate bug in permvec_from_string.
  260. XWhen:  2/15/85
  261. XWhat:  cipher.c
  262. X
  263. XWho:   Bob Baldwin
  264. XWhy:   Experimenting with new scoring functions.
  265. XWhen:  2/15/85
  266. XWhat:  stats.c
  267. X
  268. XWho:   Bob Baldwin
  269. XWhy:   Add command to try probable words from a file.
  270. XWhen:  2/15/85
  271. XWhat:  user.c
  272. XAdded: pword.c
  273. X
  274. XWho:   Bob Baldwin
  275. XWhy:   Change interface to ec_init().
  276. XWhen:  2/15/85
  277. XWhat:  autotri.c, dbsaux.c, eclass.c, edriver.c
  278. X
  279. XWho:   Bob Baldwin
  280. XWhy:   Make equiv class assume wiring in dblock window.
  281. XWhen:  2/15/85
  282. XWhat:  eclass.c
  283. X
  284. XWho:   Bob Baldwin
  285. XWhy:   Make clear zee command leave cursor on cmd line.
  286. XWhen:  2/4/85
  287. XWhat:  knit.c
  288. X
  289. XWho:   Bob Baldwin
  290. XWhy:   Bug of knit and propagate not properly restoring user area cursor.
  291. XWhen:  2/4/85
  292. XWhat:  user.c
  293. X
  294. XWho:   Bob Baldwin
  295. XWhy:   Bug overflowing string on bad argument parsing.
  296. XWhen:  2/4/85
  297. XWhat:  pgate.c, knit.c
  298. X
  299. XWho:   Bob Baldwin
  300. XWhy:   Make knit command take an arg which is the minimum guess count to show.
  301. XWhen:  2/4/85
  302. XWhat:  user.c, knit.c
  303. X
  304. XWho:   Bob Baldwin
  305. XWhy:   Make ^T try all char command smarter
  306. XWhen:  2/3/85
  307. XWhat:  dbsaux.c, Makefile
  308. XAdded: pqueue.c
  309. X
  310. XWho:   Bob Baldwin
  311. XWhy:   Divide by zero bug in pvec_1score
  312. XWhen:  2/2/85
  313. XWhat:  stats.c
  314. X
  315. XWho:   Bob Baldwin
  316. XWhy:   Fix crufty acceptance criteria for equiv class maximizing.
  317. XWhen:  2/2/85
  318. XWhat:  eclass.c, user.c
  319. X
  320. XWho:   Bob Baldwin
  321. XWhy:   Termcap file doesn't have enter graphics mode for vt100v
  322. XWhen:  2/1/85
  323. XWhat:  screen.c
  324. X
  325. XWho:   Bob Baldwin
  326. XWhy:   Add initial guess based on equivalence classes.
  327. XWhen:  2/1/85
  328. XWhat:  Makefile, user.c, gblock.c
  329. XAdded: eclass.c, edriver.c (test program)
  330. X
  331. XWho:   Bob Baldwin
  332. XWhy:   Make better abstractions for the cipher system and statistics.
  333. XWhen:  1/31/85
  334. XWhat:  stats.c, specs.h
  335. XAdded: cipher.c, cipher.h
  336. END_OF_cbw.log
  337. if test 4985 -ne `wc -c <cbw.log`; then
  338.     echo shar: \"cbw.log\" unpacked with wrong size!
  339. fi
  340. # end of overwriting check
  341. fi
  342. if test -f mss-bigram.stats -a "${1}" != "-c" ; then 
  343.   echo shar: Will not over-write existing file \"mss-bigram.stats\"
  344. else
  345. echo shar: Extracting \"mss-bigram.stats\" \(5518 characters\)
  346. sed "s/^X//" >mss-bigram.stats <<'END_OF_mss-bigram.stats'
  347. X158143
  348. X
  349. X0 \000\001\002\003\004\005\006\007\177\b\v\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037
  350. X1538 ({[<
  351. X3284 Pp
  352. X667 Xx
  353. X1509 >)}]
  354. X293 Qq
  355. X1836 Yy
  356. X2426 @*+|~^=#$%&
  357. X7301 Rr
  358. X138 Zz
  359. X7217 Ss
  360. X2980 .,:;?!
  361. X10913 Tt
  362. X666 _-
  363. X3594 Uu
  364. X891 Vv
  365. X214 \\/
  366. X1467 Ww
  367. X1052 0123456789
  368. X34092 \t\n\p\r 
  369. X266 '`"
  370. X8090 Aa
  371. X1877 Bb
  372. X3797 Cc
  373. X4324 Dd
  374. X15271 Ee
  375. X2624 Ff
  376. X2047 Gg
  377. X4466 Hh
  378. X8322 Ii
  379. X187 Jj
  380. X435 Kk
  381. X4437 Ll
  382. X3397 Mm
  383. X8366 Nn
  384. X8159 Oo
  385. X***
  386. X1848 \tI
  387. X900 ED
  388. X184 D.
  389. X327 \t0
  390. X478 H\t
  391. X850 ME
  392. X1246 TI
  393. X781 RO
  394. X13 SL
  395. X38 YS
  396. X45 'S
  397. X137 AP
  398. X20 >@
  399. X6 UF
  400. X108 @S
  401. X166 (P
  402. X245 PU
  403. X20 .>
  404. X43 HT
  405. X23 FA
  406. X5 T0
  407. X8 F(
  408. X3 _Z
  409. X20 G>
  410. X3 OX
  411. X9 \\J
  412. X17 DG
  413. X1 _A
  414. X1 .W
  415. X12 >'
  416. X1 BM
  417. X3 IQ
  418. X2 NB
  419. X1 >Y
  420. X3 _(
  421. X1 W@
  422. X510 VE
  423. X1012 AR
  424. X129 BO
  425. X908 IS
  426. X321 DI
  427. X187 CL
  428. X50 \tK
  429. X1171 ND
  430. X2 _\\
  431. X247 EF
  432. X22 E_
  433. X39 OA
  434. X76 M.
  435. X1 G'
  436. X138 @U
  437. X73 (R
  438. X10 .'
  439. X26 P>
  440. X82 .@
  441. X4 O(
  442. X19 GY
  443. X16 _C
  444. X11 Q\t
  445. X6 SN
  446. X2 D0
  447. X8 XX
  448. X4 \\L
  449. X7 G@
  450. X1 ZR
  451. X469 LL
  452. X676 A\t
  453. X291 OC
  454. X1330 AT
  455. X590 \tM
  456. X135 FE
  457. X282 SP
  458. X437 RS
  459. X7 \\N
  460. X22 M0
  461. X18 @>
  462. X86 (\t
  463. X152 XA
  464. X41 NF
  465. X245 MI
  466. X14 .B
  467. X10 TM
  468. X36 Y>
  469. X57 X(
  470. X5 'W
  471. X2 P'
  472. X61 P@
  473. X22 N_
  474. X20 _E
  475. X6 EH
  476. X15 '>
  477. X41 (T
  478. X30 PY
  479. X5 V.
  480. X9 YW
  481. X7 @W
  482. X8 Z\t
  483. X3 >D
  484. X1418 \tO
  485. X805 TO
  486. X47 RU
  487. X70 OE
  488. X673 HA
  489. X130 AV
  490. X165 VI
  491. X350 UL
  492. X203 @@
  493. X139 0>
  494. X41 @'
  495. X200 BS
  496. X34 XC
  497. X4 Y'
  498. X16 >F
  499. X11 '@
  500. X17 Y@
  501. X39 I>
  502. X16 F.
  503. X2 .D
  504. X24 H(
  505. X49 (V
  506. X17 J\t
  507. X10 W_
  508. X16 DM
  509. X23 _G
  510. X2 FG
  511. X1 @Y
  512. X2 YY
  513. X1 _.
  514. X2 NH
  515. X26 V0
  516. X18 \\P
  517. X1006 ST
  518. X2278 S\t
  519. X595 FI
  520. X65 BU
  521. X335 DO
  522. X224 EL
  523. X34 LP
  524. X222 UN
  525. X27 KS
  526. X33 _0
  527. X21 XE
  528. X138 CR
  529. X328 WH
  530. X198 MM
  531. X77 R>
  532. X13 _I
  533. X41 O.
  534. X25 0'
  535. X186 OG
  536. X23 AX
  537. X175 @B
  538. X3 .F
  539. X11 RW
  540. X1 PD
  541. X135 \tQ
  542. X6 G_
  543. X16 (X
  544. X30 0@
  545. X10 I@
  546. X27 Q(
  547. X2 YB
  548. X1 GF
  549. X1 'B
  550. X3 I'
  551. X11 \\R
  552. X177 RY
  553. X1456 \tS
  554. X1612 EN
  555. X321 TS
  556. X2344 HE
  557. X572 CT
  558. X245 MO
  559. X76 UP
  560. X114 IB
  561. X11 R'
  562. X2 ZA
  563. X24 ((
  564. X72 NL
  565. X55 (A
  566. X31 @D
  567. X69 C\t
  568. X76 GH
  569. X50 OI
  570. X10 LR
  571. X5 P_
  572. X16 X.
  573. X7 A(
  574. X1 'D
  575. X3 PF
  576. X1 B>
  577. X2 FK
  578. X14 \\T
  579. X8 R@
  580. X540 L\t
  581. X173 TU
  582. X300 \tU
  583. X482 AC
  584. X312 EP
  585. X502 UR
  586. X46 XI
  587. X44 (C
  588. X141 BY
  589. X28 VO
  590. X59 OK
  591. X17 YF
  592. X33 NN
  593. X16 WL
  594. X117 DS
  595. X161 ID
  596. X41 H.
  597. X102 PH
  598. X10 JA
  599. X78 LT
  600. X2 _M
  601. X14 >L
  602. X4 'F
  603. X25 CV
  604. X20 @F
  605. X30 RB
  606. X9 K>
  607. X9 Y_
  608. X3 .J
  609. X7 X0
  610. X1 KW
  611. X3 @_
  612. X2 \\V
  613. X1624 ER
  614. X562 UT
  615. X401 IF
  616. X256 U\t
  617. X954 \tW
  618. X430 HI
  619. X530 FO
  620. X439 OM
  621. X117 ZE
  622. X107 SA
  623. X27 GL
  624. X85 (E
  625. X34 @H
  626. X85 \t>
  627. X247 DU
  628. X133 NP
  629. X130 T>
  630. X124 RD
  631. X78 TW
  632. X17 WN
  633. X11 LV
  634. X71 MS
  635. X83 S(
  636. X7 Q.
  637. X15 >N
  638. X9 _O
  639. X4 0_
  640. X10 .L
  641. X1 K'
  642. X4 JC
  643. X2 I_
  644. X1 KY
  645. X1 'H
  646. X429 \tY
  647. X4322 E\t
  648. X157 AG
  649. X469 ET
  650. X449 CA
  651. X140 MU
  652. X172 TY
  653. X447 PL
  654. X127 SC
  655. X31 D>
  656. X1380 \t@
  657. X97 T@
  658. X223 GN
  659. X61 \t'
  660. X32 (.
  661. X3 'J
  662. X30 RF
  663. X3 R_
  664. X5 .N
  665. X3 NR
  666. X55 JE
  667. X114 OO
  668. X18 WP
  669. X16 T'
  670. X26 C(
  671. X18 A.
  672. X23 (G
  673. X2 IH
  674. X1 HK
  675. X2 _Q
  676. X12 \\A
  677. X3 \\Z
  678. X1 Z.
  679. X2 BD
  680. X1 >P
  681. X142 EV
  682. X1021 SE
  683. X1214 NT
  684. X756 \tB
  685. X1723 N\t
  686. X6 BF
  687. X236 LA
  688. X126 AI
  689. X71 CC
  690. X102 (I
  691. X10 .P
  692. X34 @L
  693. X62 (0
  694. X54 WR
  695. X6 D'
  696. X61 UX
  697. X15 D@
  698. X43 M>
  699. X17 DY
  700. X1 'L
  701. X15 YL
  702. X2 A0
  703. X6 RH
  704. X1 KD
  705. X12 _S
  706. X1 B_
  707. X15 HM
  708. X15 L(
  709. X5 TB
  710. X4 \\C
  711. X2 ZI
  712. X2 FS
  713. X1 J.
  714. X3 >R
  715. X4 IJ
  716. X447 IL
  717. X263 HO
  718. X742 \tD
  719. X415 S.
  720. X466 EX
  721. X507 CE
  722. X9 \\E
  723. X1059 >\t
  724. X146 W\t
  725. X146 OS
  726. X65 NV
  727. X100 AK
  728. X314 GR
  729. X3 M'
  730. X70 PP
  731. X99 UA
  732. X59 FU
  733. X7 >T
  734. X5 BH
  735. X15 LC
  736. X43 M@
  737. X20 @N
  738. X48 YN
  739. X5 'N
  740. X1 _U
  741. X4 (K
  742. X5 MY
  743. X2 U(
  744. X4 J0
  745. X3 .R
  746. X593 EA
  747. X878 OU
  748. X679 SI
  749. X2478 IN
  750. X511 G\t
  751. X2564 .\t
  752. X784 PR
  753. X1219 LE
  754. X835 \tF
  755. X83 YP
  756. X553 AM
  757. X110 UC
  758. X123 E(
  759. X53 \t_
  760. X133 MB
  761. X10 'P
  762. X25 GT
  763. X87 DD
  764. X18 C.
  765. X29 RL
  766. X14 _>
  767. X38 BJ
  768. X40 (M
  769. X39 @P
  770. X3 F>
  771. X4 TF
  772. X44 T_
  773. X10 .T
  774. X2 _W
  775. X8 S0
  776. X2 \\.
  777. X4 \\G
  778. X22 SK
  779. X2853 TH
  780. X232 CI
  781. X372 \tH
  782. X141 P\t
  783. X109 PT
  784. X549 EC
  785. X123 RN
  786. X256 OW
  787. X38 _@
  788. X300 BL
  789. X280 NA
  790. X199 N(
  791. X285 UE
  792. X53 D_
  793. X57 L.
  794. X50 IP
  795. X48 FY
  796. X5 F@
  797. X6 HS
  798. X21 (O
  799. X9 'R
  800. X4 @R
  801. X5 O>
  802. X15 LG
  803. X1 MD
  804. X1 0P
  805. X25 \\0
  806. X1 F'
  807. X6 \\I
  808. X852 Y\t
  809. X592 LI
  810. X88 \tJ
  811. X196 IR
  812. X245 EE
  813. X54 CK
  814. X6 _B
  815. X32 UG
  816. X226 NC
  817. X11 M_
  818. X802 @\t
  819. X13 U.
  820. X42 '\t
  821. X92 WA
  822. X5 RP
  823. X8 O@
  824. X12 DH
  825. X3 YT
  826. X14 HU
  827. X5 SM
  828. X149 @T
  829. X14 JO
  830. X18 W(
  831. X10 (Q
  832. X27 X>
  833. X27 'T
  834. X4 \\K
  835. X6 .X
  836. X1 KL
  837. X9 >A
  838. X1 O'
  839. X16 >(
  840. X440 AS
  841. X641 IT
  842. X189 SO
  843. X637 \tL
  844. X200 RR
  845. X105 TL
  846. X226 0\t
  847. X448 E.
  848. X690 NE
  849. X168 OB
  850. X75 (S
  851. X11 >C
  852. X234 QU
  853. X67 UI
  854. X41 GA
  855. X242 EG
  856. X15 H>
  857. X6 DJ
  858. X52 I\t
  859. X18 G(
  860. X11 X@
  861. X3 _D
  862. X1 MH
  863. X2 @V
  864. X1 CM
  865. X15 KN
  866. X2 .A
  867. X11 0T
  868. X3 LK
  869. X2 'V
  870. X4 \\M
  871. X1 .Z
  872. X1 BP
  873. X1 ZS
  874. X1106 R\t
  875. X713 NG
  876. X155 FF
  877. X196 RT
  878. X187 N.
  879. X674 \tN
  880. X23 DL
  881. X143 IV
  882. X431 OD
  883. X49 EI
  884. X361 PA
  885. X681 CO
  886. X114 BR
  887. X61 AU
  888. X29 .C
  889. X230 WE
  890. X261 __
  891. X6 HY
  892. X12 P(
  893. X4 Q>
  894. X4 LM
  895. X33 _F
  896. X24 H@
  897. X7 (U
  898. X7 TN
  899. X33 E0
  900. X3 >E
  901. X1 @X
  902. X1 F_
  903. X1 H'
  904. X2 .\\
  905. X15 SQ
  906. X5 \\O
  907. X4 GC
  908. X708 OF
  909. X300 GE
  910. X982 \tP
  911. X279 UM
  912. X64 JU
  913. X38 .E
  914. X108 NI
  915. X296 SS
  916. X243 LO
  917. X29 IX
  918. X152 >.
  919. X101 TP
  920. X14 B\t
  921. X22 RV
  922. X3 'A
  923. X20 @A
  924. X23 Y(
  925. X7 @(
  926. X29 O_
  927. X16 W.
  928. X6 BT
  929. X12 EK
  930. X18 DN
  931. X7 >G
  932. X132 (>
  933. X2 _H
  934. X6 (W
  935. X1 CQ
  936. X2 HB
  937. X4 AW
  938. X18 YZ
  939. X9 A>
  940. X5 Z>
  941. X1 0X
  942. X2 \\Q
  943. X129 K\t
  944. X495 EM
  945. X29 CS
  946. X210 IA
  947. X315 WI
  948. X661 \tR
  949. X267 SU
  950. X66 NK
  951. X83 IZ
  952. X204 AY
  953. X412 TR
  954. X86 G.
  955. X431 PE
  956. X16 .G
  957. X66 ..
  958. X39 @C
  959. X2 (Y
  960. X66 I(
  961. X6 'C
  962. X32 0(
  963. X148 (@
  964. X6 >0
  965. X181 @\\
  966. X6 \\S
  967. X12 J>
  968. X6 GG
  969. X5 BV
  970. X8 UO
  971. X2 OH
  972. X7 MN
  973. X1 A'
  974. X1 KT
  975. X4 YC
  976. X12 >I
  977. X4 0A
  978. X1 XF
  979. X3 '\\
  980. X1 ZY
  981. X37 YE
  982. X838 RA
  983. X323 AB
  984. X1904 T\t
  985. X3762 \tT
  986. X10293 \t\t
  987. X516 IC
  988. X34 .0
  989. X198 CU
  990. X420 MP
  991. X66 TT
  992. X18 NM
  993. X73 S>
  994. X23 .I
  995. X6 'E
  996. X230 GI
  997. X135 @E
  998. X109 LS
  999. X52 P.
  1000. X19 FL
  1001. X38 R(
  1002. X20 (B
  1003. X49 H_
  1004. X25 DR
  1005. X11 SW
  1006. X18 OJ
  1007. X5 EO
  1008. X4 _L
  1009. X1 WK
  1010. X25 0\\
  1011. X4 VN
  1012. X3 J@
  1013. X1 J'
  1014. X1 \\U
  1015. X493 US
  1016. X312 AD
  1017. X1580 D\t
  1018. X569 NO
  1019. X169 LU
  1020. X79 BA
  1021. X156 Y.
  1022. X38 RC
  1023. X62 PI
  1024. X237 OL
  1025. X10 @.
  1026. X9 S'
  1027. X7 S@
  1028. X65 (D
  1029. X47 '.
  1030. X101 EQ
  1031. X177 IE
  1032. X56 DT
  1033. X40 _N
  1034. X58 B(
  1035. X149 \tV
  1036. X61 SY
  1037. X6 @G
  1038. X28 P0
  1039. X10 Q_
  1040. X5 C>
  1041. X1 \\>
  1042. X12 >M
  1043. X1 R\\
  1044. X1 MR
  1045. X1 \\W
  1046. X188 0.
  1047. X1901 RE
  1048. X186 WO
  1049. X1484 ON
  1050. X1327 ES
  1051. X369 M\t
  1052. X4 KA
  1053. X32 AF
  1054. X5 DV
  1055. X69 @0
  1056. X324 IG
  1057. X26 I.
  1058. X95 @I
  1059. X37 YI
  1060. X5 >O
  1061. X22 CY
  1062. X51 \tX
  1063. X26 (F
  1064. X2 '0
  1065. X30 _P
  1066. X20 L>
  1067. X7 LW
  1068. X17 NQ
  1069. X5 'I
  1070. X11 (_
  1071. X5 XL
  1072. X2 C'
  1073. X6 C@
  1074. X8 .M
  1075. X1 GM
  1076. X36 \\@
  1077. X1 \\Y
  1078. X2366 \tA
  1079. X458 NS
  1080. X351 00
  1081. X571 TA
  1082. X339 LY
  1083. X118 FR
  1084. X188 OP
  1085. X351 \t(
  1086. X646 BE
  1087. X156 R.
  1088. X85 RG
  1089. X180 T(
  1090. X5 V\t
  1091. X13 U>
  1092. X104 EU
  1093. X30 \tZ
  1094. X50 GO
  1095. X25 VT
  1096. X6 I0
  1097. X5 HL
  1098. X9 L@
  1099. X3 (H
  1100. X4 XN
  1101. X2 JF
  1102. X2 L'
  1103. X3 II
  1104. X18 SD
  1105. X4 PM
  1106. X15 0I
  1107. X2 >Q
  1108. X2 \\B
  1109. X830 F\t
  1110. X1002 OR
  1111. X524 RI
  1112. X1161 \tC
  1113. X166 KE
  1114. X16 TC
  1115. X22 IK
  1116. X52 S_
  1117. X72 FT
  1118. X299 E>
  1119. X288 PO
  1120. X29 LB
  1121. X35 B.
  1122. X3 U@
  1123. X32 @M
  1124. X127 DA
  1125. X138 NU
  1126. X44 _\t
  1127. X110 EW
  1128. X13 (J
  1129. X113 D(
  1130. X12 SF
  1131. X13 WS
  1132. X117 XP
  1133. X35 _T
  1134. X60 YM
  1135. X4 HN
  1136. X5 AJ
  1137. X5 .Q
  1138. X3 'M
  1139. X13 >S
  1140. X5 U'
  1141. X2 \\D
  1142. X2 CD
  1143. X716 AL
  1144. X794 \tE
  1145. X509 MA
  1146. X1311 TE
  1147. X366 YO
  1148. X879 O\t
  1149. X35 RK
  1150. X155 SH
  1151. X302 OT
  1152. X88 UB
  1153. X30 K.
  1154. X30 BI
  1155. X2 C_
  1156. X203 LD
  1157. X120 E@
  1158. X9 'O
  1159. X53 EY
  1160. X69 N>
  1161. X345 IM
  1162. X15 E'
  1163. X37 GS
  1164. X26 (L
  1165. X2 @O
  1166. X11 _V
  1167. X12 .S
  1168. X2 \\_
  1169. X2 NW
  1170. X4 M(
  1171. X13 \\F
  1172. X62 UD
  1173. X911 DE
  1174. X861 IO
  1175. X189 \tG
  1176. X1231 AN
  1177. X500 CH
  1178. X20 PS
  1179. X281 T.
  1180. X1 L_
  1181. X123 VA
  1182. X81 XT
  1183. X262 RM
  1184. X100 \t.
  1185. X2 _X
  1186. X80 X\t
  1187. X128 OV
  1188. X104 NY
  1189. X49 KI
  1190. X44 GU
  1191. X6 W>
  1192. X7 EB
  1193. X28 HR
  1194. X71 (N
  1195. X108 >>
  1196. X4 \\H
  1197. X32 N'
  1198. X8 LF
  1199. X10 N@
  1200. X2 >W
  1201. X***
  1202. X-2.0964
  1203. X0.513225
  1204. X0.716397
  1205. X
  1206. END_OF_mss-bigram.stats
  1207. if test 5518 -ne `wc -c <mss-bigram.stats`; then
  1208.     echo shar: \"mss-bigram.stats\" unpacked with wrong size!
  1209. fi
  1210. # end of overwriting check
  1211. fi
  1212. if test -f pword.c -a "${1}" != "-c" ; then 
  1213.   echo shar: Will not over-write existing file \"pword.c\"
  1214. else
  1215. echo shar: Extracting \"pword.c\" \(5380 characters\)
  1216. sed "s/^X//" >pword.c <<'END_OF_pword.c'
  1217. X/*
  1218. X * Automatic guessing based on probable words.
  1219. X *
  1220. X * Bob Baldwin, February 1985.
  1221. X */
  1222. X
  1223. X#include    <stdio.h>
  1224. X#include    <math.h>
  1225. X#include    "window.h"
  1226. X#include    "terminal.h"
  1227. X#include    "layout.h"
  1228. X#include    "specs.h"
  1229. X#include    "cipher.h"
  1230. X#include    "autotri.h"
  1231. X
  1232. X
  1233. X#define    DEBUG    FALSE
  1234. X
  1235. X#define    NWORDS        100
  1236. X#define WDBUFSZ        (8*NWORDS)
  1237. X#define    WDPERMSZ    40
  1238. X#define    PWDLABEL1    "Probable word search -- Please Wait"
  1239. X#define    PWDLABEL2    "Probable word search -- Done"
  1240. X#define    PWDHELP        "F3 enters guess, ^G undoes it."
  1241. X
  1242. X
  1243. Xextern    char    mcbuf[];
  1244. Xextern    ecinfo    gecinfo;
  1245. Xextern    atrinfo gatrinfo;
  1246. Xextern    atrdraw(), atrfirst(), atrenter(), atrundo();
  1247. Xextern    char    *pwd_init();
  1248. X
  1249. X/* Gloabal State. */
  1250. Xchar    *word_tab[NWORDS];
  1251. Xchar    word_buf[WDBUFSZ];
  1252. X
  1253. Xkeyer    pwdktab[] = {
  1254. X        {CACCEPT, atrenter},
  1255. X        {CUNDO, atrundo},
  1256. X        {CGO_UP, jogup},
  1257. X        {CGO_DOWN, jogdown},
  1258. X        {CGO_LEFT, jogleft},
  1259. X        {CGO_RIGHT, jogright},
  1260. X        {0, NULL},
  1261. X};
  1262. X
  1263. X/* Routine invoked by user to search of a list of probable words.
  1264. X * The window is drawn empty, and then filled in with the guess.
  1265. X * Return NULL if command completes ok.
  1266. X */
  1267. Xchar    *pwdguess(str)
  1268. Xchar    *str;            /* Command line */
  1269. X{
  1270. X    gwindow    *pwd;
  1271. X    atrinfo    *pwdi;
  1272. X    ecinfo    *ecbi;
  1273. X    int        *dbsperm;
  1274. X    float    max_score;
  1275. X    char    *errmsg;
  1276. X    int        i;
  1277. X    char    filename[MAXWIDTH+1];
  1278. X
  1279. X    if ((i = sscanf(str, "%*[^:]: %s %*[^:]: %f",
  1280. X        filename, &max_score)) != 2)  {
  1281. X            return("Could not parse both arguments.");
  1282. X        }
  1283. X
  1284. X    pwd = &gbstore;
  1285. X    pwdi = &gatrinfo;
  1286. X    dbsperm = refperm(dbsgetblk(&dbstore));
  1287. X    errmsg = pwd_init(filename, mcbuf, dbsperm, pwdi);
  1288. X    if (errmsg != NULL)  return(errmsg);
  1289. X
  1290. X    ecbi = pwdi->eci;
  1291. X    pwdi->min_total_chars = 1;
  1292. X    pwdi->max_score = max_score;
  1293. X    pwdi->min_wire_chars = 0;
  1294. X
  1295. X    gbsswitch(pwd, ((char *) pwdi), pwdktab, atrfirst, wl_noop, atrdraw);
  1296. X
  1297. X    gblset(&gblabel, PWDLABEL1);
  1298. X    atrdraw(pwd);
  1299. X    fflush(stdout);
  1300. X
  1301. X    pwd_autoguess(pwdi);
  1302. X    decode(ecbi->ciphertext, ecbi->plaintext, ecbi->perm);
  1303. X
  1304. X    gblset(&gblabel, PWDLABEL2);
  1305. X    atrdraw(pwd);
  1306. X
  1307. X    return(NULL);
  1308. X}
  1309. X
  1310. X
  1311. X/* Load a word table from the given file.
  1312. X * Format is a word on each line terminated by a blank line
  1313. X * Returns error message or NULL.
  1314. X */
  1315. Xchar *wtab_load_from(filename, charbuf, buffree, wtab, tabsize)
  1316. Xint        buffree, tabsize;
  1317. Xchar    *filename, *charbuf;
  1318. Xchar    *wtab[];
  1319. X{
  1320. X    FILE    *inp;
  1321. X    char    *wordstart;
  1322. X    int        wordindex, wordlength;
  1323. X    int        c;
  1324. X
  1325. X    if ((inp = fopen(filename, "r"))== NULL)  {
  1326. X        return("Cannot open file to read probable words.");
  1327. X        }
  1328. X
  1329. X    wordindex = 0;
  1330. X    while(wordindex < tabsize-1)  {
  1331. X        wordstart = charbuf;
  1332. X        wordlength = 0;
  1333. X        while ((c = read_char(inp)) != EOL) {
  1334. X            *charbuf++ = c;
  1335. X            wordlength++;
  1336. X            buffree--;
  1337. X            if (buffree <= 1)  break;
  1338. X            }
  1339. X        *charbuf++ = NULL;
  1340. X        buffree--;
  1341. X        if (wordlength == 0  ||  buffree <= 0)  break;
  1342. X        wtab[wordindex++] = wordstart;
  1343. X        }
  1344. X
  1345. X    wtab[wordindex] = NULL;
  1346. X
  1347. X    fclose(inp);
  1348. X    return(NULL);
  1349. X}
  1350. X
  1351. X
  1352. X
  1353. X/* Fill in probable word info from given ciphertext block.
  1354. X * The filter parameters are not set by this routine.
  1355. X */
  1356. Xchar *pwd_init(filename, cipher, perm, pwdi)
  1357. Xchar    *filename;
  1358. Xchar    cipher[];
  1359. Xint        perm[];
  1360. Xatrinfo    *pwdi;
  1361. X{
  1362. X    int        i;
  1363. X    char    *errmsg;
  1364. X
  1365. X    pwdi->eci = &gecinfo;
  1366. X    errmsg = wtab_load_from(filename, word_buf, WDBUFSZ, word_tab, NWORDS);
  1367. X    if (errmsg != NULL)  return(errmsg);
  1368. X    ec_init(cipher, perm, pwdi->eci);
  1369. X    pwd_guess_init(pwdi);
  1370. X    return(NULL);
  1371. X}
  1372. X
  1373. X
  1374. X/* Per guess initialization.
  1375. X */
  1376. Xpwd_guess_init(pwdi)
  1377. Xatrinfo    *pwdi;
  1378. X{
  1379. X    pwdi->best_trigram = NULL;
  1380. X    pwdi->best_score = 10.0;
  1381. X    pwdi->gcount = 0;
  1382. X    pwdi->total_score = 0;
  1383. X    pwdi->best_pvec[0] = NONE;
  1384. X    pwdi->best_permvec[0].x = NONE;
  1385. X}
  1386. X
  1387. X
  1388. X
  1389. X/* Score a word at a given position.
  1390. X * Fills in permvec and pvec.
  1391. X */
  1392. Xfloat    pwd_score(pwdi, word, pos, permvec, pvec)
  1393. Xatrinfo        *pwdi;
  1394. Xchar        *word;
  1395. Xint            pos;
  1396. Xperment        permvec[];
  1397. Xint            pvec[];
  1398. X{
  1399. X    int        added, wordlen;
  1400. X    char    *p;
  1401. X    float    score;
  1402. X    ecinfo    *eci;
  1403. X
  1404. X    p = word;
  1405. X    wordlen = 0;
  1406. X    while (*p++ != NULL)  wordlen++;
  1407. X    eci = pwdi->eci;
  1408. X    added = permvec_from_string(pwdi->eci, word, pos, permvec);
  1409. X    if (added == ERROR)  return(-1.0);
  1410. X    added = permvec2pvec(pwdi->eci, permvec, pvec, -1, -1);
  1411. X    if (added == ERROR)  return(-1.0);
  1412. X    if (added < pwdi->min_total_chars) {
  1413. X        return(-1.0);
  1414. X        }
  1415. X
  1416. X    score = pvec_1score(pvec);
  1417. X#if DEBUG
  1418. X    print_pvec(stdout, pvec);
  1419. X    printf("Putting %s at %d, gets a score of %f\n",
  1420. X            word, pos, score);
  1421. X#endif
  1422. X    return(score);
  1423. X}
  1424. X
  1425. X
  1426. X/* Select the best probable word for a given position.
  1427. X * Returns pointer to the word, or NULL.
  1428. X * Fills in pwdi with additional information.
  1429. X * Filtering parameters are passed in pwdi.
  1430. X */
  1431. Xchar    *pwd_best(pwdi, pos)
  1432. Xatrinfo    *pwdi;
  1433. Xint        pos;
  1434. X{
  1435. X    int        windex;
  1436. X    float    score;
  1437. X    perment    permvec[WDPERMSZ];
  1438. X    int        pvec[BLOCKSIZE+1];
  1439. X
  1440. X    pwd_guess_init(pwdi);
  1441. X
  1442. X    for (windex = 0 ; word_tab[windex] != NULL ; windex++)  {
  1443. X        score = pwd_score(pwdi, word_tab[windex], pos, permvec, pvec);
  1444. X        if (score < 0.0)  continue;
  1445. X        pwdi->gcount++;
  1446. X        pwdi->total_score += score;
  1447. X        if (score < pwdi->best_score) {
  1448. X            pwdi->best_score = score;
  1449. X            pwdi->best_trigram = word_tab[windex];
  1450. X            pvec_copy(pvec, pwdi->best_pvec);
  1451. X            permvec_copy(permvec, pwdi->best_permvec, WDPERMSZ);
  1452. X            }
  1453. X        }
  1454. X    if (pwdi->best_score < pwdi->max_score)
  1455. X        {return(pwdi->best_trigram);}
  1456. X    else
  1457. X        {return(NULL);}
  1458. X}
  1459. X
  1460. X
  1461. X
  1462. X/* Perform automatic guessing given a set of
  1463. X * filter parameters in an atrinfo structure.
  1464. X */
  1465. Xpwd_autoguess(pwdi)
  1466. Xatrinfo    *pwdi;
  1467. X{
  1468. X    int        pos;
  1469. X    char    *word;
  1470. X
  1471. X    for (pos = 0 ; pos < BLOCKSIZE ; pos++) {
  1472. X        word = pwd_best(pwdi, pos);
  1473. X        if (word != NULL) {
  1474. X            accept_permvec(pwdi, pwdi->best_permvec);
  1475. X            }
  1476. X        }
  1477. X}
  1478. END_OF_pword.c
  1479. if test 5380 -ne `wc -c <pword.c`; then
  1480.     echo shar: \"pword.c\" unpacked with wrong size!
  1481. fi
  1482. # end of overwriting check
  1483. fi
  1484. if test -f screen.c -a "${1}" != "-c" ; then 
  1485.   echo shar: Will not over-write existing file \"screen.c\"
  1486. else
  1487. echo shar: Extracting \"screen.c\" \(5791 characters\)
  1488. sed "s/^X//" >screen.c <<'END_OF_screen.c'
  1489. X/* Screen interface package
  1490. X *
  1491. X * Author: Bob Baldwin  June 1983
  1492. X * $Date: 86/01/15 16:04:16 $
  1493. X * $Log:    screen.c,v $
  1494. X * Revision 1.1  86/01/15  16:04:16  baldwin
  1495. X * Initial revision
  1496. X * 
  1497. X * Much code moved to terminal.c  baldwin 10/86
  1498. X *
  1499. X * Revision 1.2  85/01/10  02:35:10  simsong
  1500. X * Changed to termcap support
  1501. X * 
  1502. X * Revision 1.1  85/01/09  23:45:10  simsong
  1503. X * Initial revision
  1504. X * 
  1505. X */
  1506. X
  1507. X
  1508. X/* The screen consists of 24 lines and 80 columns.  The basic screen
  1509. X * operation is replacing the character that is already at a given
  1510. X * position with a new character.  That is, characters are placed,
  1511. X * they are not inserted.
  1512. X *
  1513. X * Various commands are provided for positioning the cursor, placing
  1514. X * strings on the screen, and removing characters.
  1515. X *
  1516. X * If a routine finds something wrong or inconsistent, it will print
  1517. X * an error message on the screen.
  1518. X */
  1519. X
  1520. X
  1521. X#include <stdio.h>
  1522. X#include <strings.h>
  1523. X#include "window.h"
  1524. X#include "terminal.h"
  1525. X#include "specs.h"
  1526. X
  1527. X
  1528. X
  1529. X/* These variables contain the current location of the cursor.
  1530. X * The origin, or home, of the  cursor is in the upper lefthand
  1531. X * corner of the screen.  That location is line 1, column 1.
  1532. X * The lower righthand corner of the screen is the location
  1533. X * identified by line 24, column 80.
  1534. X */
  1535. X
  1536. Xint    cline;
  1537. Xint    ccolumn;
  1538. X
  1539. X/* These must be 24 and 80 since only that region of the screen
  1540. X * is covered by the windows.  The wl_driver() routine will
  1541. X * exit if the cursor moves out of that area.
  1542. X */
  1543. Xint    MXLINE = MAXHEIGHT;        /* Max line number */
  1544. Xint    MXCOL = MAXWIDTH;        /* Max column number */
  1545. X
  1546. X
  1547. X
  1548. X/* Clear Screen.  This should be the first screen operation called in order
  1549. X * to initialize the line and column locations.
  1550. X */
  1551. Xclrscreen()
  1552. X{
  1553. X    enter_mode(SMNORMAL);
  1554. X    Puts(erase_scr);                /* clear the screen */
  1555. X    cline = 1;
  1556. X    ccolumn = 1;
  1557. X}
  1558. X
  1559. X
  1560. X/* Set Cursor Position.  The next character places on the screen
  1561. X * will appear in the given line and column.
  1562. X *
  1563. X * Note: Bob's code is broken in that it assumes the screen goes
  1564. X * from 1..24 and 1..80, rather than 0..23 and 0..79. So this
  1565. X * routine subtracs one before it calls the curses routine.
  1566. X */
  1567. Xsetcursor(line, column)
  1568. Xint    line, column;        /* ranges: 1..24 and 1..80 inclusive */
  1569. X{
  1570. X    if (line < 1 || line > MXLINE  ||  column < 1 || column > MXCOL)  {
  1571. X        disperr("setcursor tried to move cursor off screen");
  1572. X        return;
  1573. X        }
  1574. X
  1575. X    cline = line;
  1576. X    ccolumn = column;
  1577. X    
  1578. X    enter_mode(SMNORMAL);
  1579. X    Puts(tgoto(cm,column-1,line-1));
  1580. X}
  1581. X
  1582. X
  1583. X/* Return the row location of the cursor (1 is in upper-left corner).
  1584. X */
  1585. Xrowcursor()
  1586. X{
  1587. X    return(cline);
  1588. X}
  1589. X
  1590. X
  1591. X/* Return the row location of the cursor (1 is in upper-left corner).
  1592. X */
  1593. Xcolcursor()
  1594. X{
  1595. X    return(ccolumn);
  1596. X}
  1597. X
  1598. X
  1599. X
  1600. X/* Get Cursor Position
  1601. X * The value returned equals 256*LineNumber + ColumnNumber
  1602. X */
  1603. Xint    getcursor()
  1604. X{
  1605. X    return((cline<<8)+ccolumn);
  1606. X}
  1607. X
  1608. X
  1609. X/* Jog the Cursor one position
  1610. X * The value of dir determines the direction of travel:
  1611. X * 1 = up, 2 = down, 3 = left, 4 = right.  A value other than one of those
  1612. X * four will cause an error message to be printed.
  1613. X */
  1614. X/* of course, there is a more ellegant way to implement this */
  1615. X
  1616. Xjogcursor(dir)
  1617. Xint    dir;
  1618. X{
  1619. X    switch(dir) {
  1620. X        case 1:    cline = (cline<=1) ? 1 : cline-1;
  1621. X            break;
  1622. X        case 2:    cline = (cline >= MXLINE) ? MXLINE : cline+1;
  1623. X            break;
  1624. X        case 3:    ccolumn = (ccolumn <= 1) ? 1 : ccolumn-1;
  1625. X            break;
  1626. X        case 4:    ccolumn = (ccolumn >= MXCOL) ? MXCOL : ccolumn+1;
  1627. X            break;
  1628. X        default:
  1629. X            disperr("jogcursor arg out of range");
  1630. X            return;
  1631. X        }
  1632. X
  1633. X    setcursor(cline, ccolumn);
  1634. X}
  1635. X
  1636. X
  1637. X/* Place String on the current line.  The cursor is advanced to the
  1638. X * position after the last character in the string, unless we hit the
  1639. X * edge of the screen in which case the cursor stays pinned to the
  1640. X * edge and doesn't move beyond it.
  1641. X */
  1642. Xplstring(s)
  1643. Xchar    *s;
  1644. X{
  1645. X    for ( ; *s != NULL ; s++)  {
  1646. X        putsym((*s) & 0377);
  1647. X    }
  1648. X    ccolumn += strlen(s);
  1649. X    if (ccolumn >= MXCOL)
  1650. X          ccolumn = MXCOL;    /* Assumes no wrap-around. */
  1651. X}
  1652. X
  1653. X
  1654. X/* Place a number of Spaces
  1655. X * This routine can also be used to erase characters on the screen by
  1656. X * overwriting them with spaces.
  1657. X */
  1658. Xplnspaces(n)
  1659. Xint    n;
  1660. X{    int    i;
  1661. X    if (n < 0)  {
  1662. X        disperr("plnspaces: negative arg");
  1663. X        return;
  1664. X        }
  1665. X
  1666. X    for (i = 0 ; i < n ; i++)  {
  1667. X        putsym(' ');
  1668. X        }
  1669. X    ccolumn += n;
  1670. X    if (ccolumn >= MXCOL)
  1671. X          ccolumn = MXCOL;
  1672. X}
  1673. X
  1674. X
  1675. X/* Place a Number of a given Character
  1676. X */
  1677. Xplnchars(n, c)
  1678. Xint    n;
  1679. Xint    c;
  1680. X{    
  1681. X    int    i;
  1682. X    if (n < 0)  {
  1683. X        disperr("plnchars: negative arg");
  1684. X        return;
  1685. X        }
  1686. X
  1687. X    for (i = 0 ; i < n ; i++)  {
  1688. X        putsym(c);
  1689. X        }
  1690. X    ccolumn += n;
  1691. X    if (ccolumn >= MXCOL)
  1692. X          ccolumn = MXCOL;
  1693. X}
  1694. X
  1695. X
  1696. X/* Vertical place a Character a Number of times.
  1697. X * This routine can be used to draw vertical lines using
  1698. X * a given character.  It correctly handles displaying
  1699. X * in column 80.
  1700. X * The cursor is moved to the position below the last character
  1701. X * placed on the screen.  However the cursor will not move below
  1702. X * the last line on the screen.
  1703. X */
  1704. Xvertnchars(n,c)
  1705. Xint    n;
  1706. Xint    c;
  1707. X{
  1708. X    int    i;
  1709. X    if (n < 0)  {
  1710. X        disperr("vertnchars: negative arg");
  1711. X        return;
  1712. X        }
  1713. X
  1714. X    for (i = 0 ; i < n ; i++)  {
  1715. X        putsym(c);
  1716. X        /* Assume cursor motion ok even in graphic mode. */
  1717. X        setcursor(++cline, ccolumn);
  1718. X        if (cline >= MXLINE)  {
  1719. X            cline = MXLINE;
  1720. X            break;
  1721. X            }
  1722. X        }
  1723. X}
  1724. X
  1725. X
  1726. X/* Delete characters after the cursor up until the End Of the Line
  1727. X */
  1728. Xdeleol()
  1729. X{
  1730. X    Puts(erase_eol);
  1731. X}
  1732. X
  1733. X
  1734. X/* Delete characters after the cursor up until the End Of the Screen
  1735. X */
  1736. Xdeleos()
  1737. X{
  1738. X    Puts(erase_eos);
  1739. X}
  1740. X
  1741. X
  1742. X/* Display Error message.  The message is a string that does not end
  1743. X * with a \n.
  1744. X */
  1745. Xdisperr(s)
  1746. Xchar    *s;
  1747. X{    int    sline, scolumn;        /* Saved line and column numbers. */
  1748. X
  1749. X    sline = cline;
  1750. X    scolumn  = ccolumn;
  1751. X
  1752. X/*    setcursor(1, 1);     avoid bug when screen size unknown. */
  1753. X    printf("\n%s\n", s);
  1754. X/*    setcursor(sline, scolumn);  or position not set. */
  1755. X}
  1756. X
  1757. X
  1758. X/* Put a string to stdout without trailing newline.
  1759. X */
  1760. XPuts(s)
  1761. Xchar *s;
  1762. X{
  1763. X    while(*s)
  1764. X        putchar(*s++);
  1765. X}
  1766. END_OF_screen.c
  1767. if test 5791 -ne `wc -c <screen.c`; then
  1768.     echo shar: \"screen.c\" unpacked with wrong size!
  1769. fi
  1770. # end of overwriting check
  1771. fi
  1772. if test -f tdriver.c -a "${1}" != "-c" ; then 
  1773.   echo shar: Will not over-write existing file \"tdriver.c\"
  1774. else
  1775. echo shar: Extracting \"tdriver.c\" \(5804 characters\)
  1776. sed "s/^X//" >tdriver.c <<'END_OF_tdriver.c'
  1777. X/*
  1778. X * Test driver for automated trigram guessing.
  1779. X */
  1780. X
  1781. X#include    <stdio.h>
  1782. X#include    <math.h>
  1783. X#include    "window.h"
  1784. X#include    "specs.h"
  1785. X#include    "cipher.h"
  1786. X#include    "autotri.h"
  1787. X
  1788. X
  1789. Xextern    char    *atr_best();
  1790. Xextern            atr_autoguess();
  1791. Xextern    float    atr_score();
  1792. Xextern    int        accept_permvec();
  1793. X
  1794. Xatrinfo    myatrinfo;
  1795. Xchar    plainbuf[BLOCKSIZE+1];
  1796. Xint        naccepted, nwrong, nright;        /* Number of wires accepted / wrong. */
  1797. X
  1798. Xextern    char    mcbuf[];
  1799. X
  1800. X/* Test routine for automated trigram guessing. */
  1801. Xmain(argc, argv)
  1802. Xint        argc;
  1803. Xchar    *argv[];
  1804. X{
  1805. X    FILE    *inp;
  1806. X    int        i, blknum;
  1807. X    int        nblocks;
  1808. X    int        *saveperm;
  1809. X    long    filelength;
  1810. X    atrinfo    *atri;
  1811. X    char    permfbuf[100];
  1812. X    char    cipherfbuf[100];
  1813. X    char    plainfbuf[100];
  1814. X    char    *perm = ".perm";
  1815. X    char    *plain = ".txt";
  1816. X    char    *code = ".cipher";
  1817. X    char    *p, *q;
  1818. X
  1819. X    if (argc != 5)  {
  1820. X        printf("Usage: %s input_file_root", argv[0]);
  1821. X        printf(" min_score min_total_chars min_per_wire_chars\n");
  1822. X        exit(0);
  1823. X        }
  1824. X
  1825. X    p = cipherfile = cipherfbuf;
  1826. X    q = argv[1];
  1827. X    while (*p++ = *q++);
  1828. X    --p;
  1829. X    q = code;
  1830. X    while (*p++ = *q++);
  1831. X
  1832. X    p = plainfbuf;
  1833. X    q = argv[1];
  1834. X    while (*p++ = *q++);
  1835. X    --p;
  1836. X    q = plain;
  1837. X    while (*p++ = *q++);
  1838. X
  1839. X    p = permfile = permfbuf;
  1840. X    q = argv[1];
  1841. X    while (*p++ = *q++);
  1842. X    --p;
  1843. X    q = perm;
  1844. X    while (*p++ = *q++);
  1845. X
  1846. X    atri = &myatrinfo;
  1847. X
  1848. X    if (sscanf(argv[2], "%f", &atri->max_score) != 1)  {
  1849. X        printf("Could not parse the max score from %s.\n", argv[2]);
  1850. X        exit(0);
  1851. X        }
  1852. X
  1853. X    if (sscanf(argv[3], "%d", &atri->min_total_chars) != 1)  {
  1854. X        printf("Could not parse the min chars from %s.\n", argv[2]);
  1855. X        exit(0);
  1856. X        }
  1857. X
  1858. X    if (sscanf(argv[4], "%d", &atri->min_wire_chars) != 1)  {
  1859. X        printf("Could not parse the min chars from %s.\n", argv[2]);
  1860. X        exit(0);
  1861. X        }
  1862. X
  1863. X    permchgflg = FALSE;
  1864. X
  1865. X    letterstats = "mss.stats";
  1866. X    trigramstats = "trigrams.stats";
  1867. X    load_1stats_from(letterstats);
  1868. X    load_tri_from(trigramstats);
  1869. X
  1870. X    if ((inp = fopen(cipherfile, "r")) == NULL) {
  1871. X        printf("\nCannot open %s for reading.\n", cipherfile);
  1872. X        exit(0);
  1873. X        }
  1874. X    fseek(inp, 0L, 2);
  1875. X    filelength = ftell(inp);
  1876. X    fclose(inp);
  1877. X
  1878. X    nblocks = filelength / BLOCKSIZE;
  1879. X    if (nblocks > NPERMS)  nblocks = NPERMS;
  1880. X
  1881. X    printf("\t\tAutomated Trigram Guessing");
  1882. X    printf(" for %s\n\n",cipherfile);
  1883. X    printf("Max score = %4.2f", atri->max_score);
  1884. X    printf(".  Min total chars = %d", atri->min_total_chars);
  1885. X    printf(".  Min per wire chars = %d", atri->min_wire_chars);
  1886. X    printf("\n\n");
  1887. X    for (blknum = 0 ; blknum < nblocks ; blknum++) {
  1888. X        do_block(blknum, cipherfile, plainfbuf, atri);
  1889. X        saveperm = refperm(blknum);
  1890. X        for (i = 0 ; i < BLOCKSIZE ; i++)
  1891. X            saveperm[i] = atri->eci->perm[i];
  1892. X        }
  1893. X
  1894. X    permsave();
  1895. X}
  1896. X
  1897. X
  1898. Xdo_block(blknum, cfile, pfile, atri)
  1899. Xint        blknum;
  1900. Xchar    *cfile, *pfile;
  1901. Xatrinfo    *atri;
  1902. X{
  1903. X    int        i,c,x,y;
  1904. X    int        j;
  1905. X    int        pos;
  1906. X    char    *trigram;
  1907. X    int        charcount;                /* Number of characters deduced. */
  1908. X    float    score;
  1909. X    int        *dbsperm;
  1910. X    perment    permvector[PERMSZ];
  1911. X    int        pvec[BLOCKSIZE+1];
  1912. X    char    str[BLOCKSIZE+1];
  1913. X
  1914. X    cipherfile = pfile;
  1915. X    fillcbuf(blknum, plainbuf);
  1916. X    cipherfile = cfile;
  1917. X    fillcbuf(blknum, mcbuf);
  1918. X
  1919. X    dbsperm = refperm(blknum);
  1920. X    atr_init(mcbuf, dbsperm, atri);
  1921. X
  1922. X    ec_autoguess(atri->eci, 1.7);
  1923. X/*    decode(atri->eci->ciphertext, atri->eci->plaintext, atri->eci->perm);
  1924. X
  1925. X    naccepted = 0;
  1926. X    nwrong = 0;
  1927. X    nright = 0;
  1928. X    charcount = 0;
  1929. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  1930. X        if (atri->eci->plaintext[i] != NONE)  charcount++;
  1931. X        if (((y=atri->eci->perm[i]) != NONE) && (i < y))  naccepted++;
  1932. X        }
  1933. X
  1934. X    printf("\n\nEquiv Guessing for block %d yields %d wires",blknum,naccepted);
  1935. X    printf(" and %d characters.\n\n", charcount);
  1936. X    ec_dplain(stdout, atri->eci);
  1937. X*/
  1938. X
  1939. X    naccepted = 0;
  1940. X    nwrong = 0;
  1941. X    nright = 0;
  1942. X
  1943. X    printf("\n\nStarting block %d.\n", blknum);
  1944. X#if TRUE
  1945. X    for (pos = 0 ; pos < BLOCKSIZE ; pos++) {
  1946. X        trigram = atr_best(atri, pos);
  1947. X        if (trigram != NULL) {
  1948. X            accept_permvec(atri, atri->best_permvec);
  1949. X/*            printf("\n");
  1950. X            printf("Best trigram at %d is '%s'", pos, atri->best_trigram);
  1951. X            pvec2str(str, atri->best_pvec);
  1952. X            printf(" which deduced '%s'", str);
  1953. X            printf(" with a score of %f", atri->best_score);
  1954. X            printf(".\n");
  1955. X            printf("There were %d guesses", atri->gcount);
  1956. X            printf(" yeilding a total score of %f", atri->total_score);
  1957. X            printf(".\n");
  1958. X*/
  1959. X            if (wrong_guess(plainbuf, pos, atri->best_trigram))  {
  1960. X                nwrong++;
  1961. X/*                printf("WRONG\n");*/
  1962. X                }
  1963. X            else {
  1964. X                nright++;
  1965. X/*                printf("CORRECT\n");*/
  1966. X                }
  1967. X            }
  1968. X        }
  1969. X#else
  1970. X    atr_autoguess(atri);
  1971. X#endif
  1972. X
  1973. X    decode(atri->eci->ciphertext, atri->eci->plaintext, atri->eci->perm);
  1974. X
  1975. X    charcount = 0;
  1976. X    for (i = 0 ; i < BLOCKSIZE ; i++)  {
  1977. X        if (atri->eci->plaintext[i] != NONE)  charcount++;
  1978. X        if (((y=atri->eci->perm[i]) != NONE) && (i < y))  naccepted++;
  1979. X        }
  1980. X
  1981. X    printf("\n\nPlaintext for block %d using %d wires", blknum, naccepted);
  1982. X    printf(" yields %d characters.", charcount);
  1983. X#if TRUE
  1984. X    printf("\nThere were %d right guesses and %d wrong ones.",nright, nwrong);
  1985. X#endif
  1986. X    printf("\n\n");
  1987. X    ec_dplain(stdout, atri->eci);
  1988. X}
  1989. X
  1990. X
  1991. X/* Look for best trigram at given position.
  1992. X */
  1993. Xtrytri(atri, pos, tindex)
  1994. Xatrinfo    *atri;
  1995. Xint        pos;
  1996. Xint        tindex;
  1997. X{
  1998. X    int        i;
  1999. X    int        j, x, y;
  2000. X    char    *trigram;
  2001. X    char    str[BLOCKSIZE+1];
  2002. X
  2003. X/*
  2004. X    trigram = atr_best(atri, pos, min_score);
  2005. X
  2006. X    if (trigram != NULL) {
  2007. X        printf("Best trigram is %s", atri->best_trigram);
  2008. X        pvec2str(str, atri->best_pvec);
  2009. X        printf(" which deduced '%s'", str);
  2010. X        printf("' with a score of %f", atri->best_score);
  2011. X        printf(".\n");
  2012. X        printf("There were %d guesses", atri->gcount);
  2013. X        printf(" yeilding a total score of %d", atri->total_score);
  2014. X        printf(".\n");
  2015. X        }
  2016. X*/
  2017. X}
  2018. X
  2019. X
  2020. X/* Return TRUE if the guess is wrong.
  2021. X */
  2022. Xint    wrong_guess(plaintext, position, trigram)
  2023. Xchar    *plaintext;
  2024. Xint        position;
  2025. Xchar    *trigram;
  2026. X{
  2027. X    char    *guess, *reality;
  2028. X
  2029. X    guess = trigram;
  2030. X    reality = &plaintext[position];
  2031. X
  2032. X    while (*guess) {
  2033. X        if (*guess++ != *reality++)  return(TRUE);
  2034. X        }
  2035. X
  2036. X    return(FALSE);
  2037. X}
  2038. X
  2039. X
  2040. X
  2041. Xkey    u_getkey()
  2042. X{
  2043. X}
  2044. X
  2045. Xkeyer    topktab[] ={{0, NULL}};
  2046. X
  2047. X
  2048. Xchar *quitcmd(arg)
  2049. Xchar    *arg;
  2050. X{
  2051. X    printf("\n");
  2052. X    exit(1);
  2053. X}
  2054. END_OF_tdriver.c
  2055. if test 5804 -ne `wc -c <tdriver.c`; then
  2056.     echo shar: \"tdriver.c\" unpacked with wrong size!
  2057. fi
  2058. # end of overwriting check
  2059. fi
  2060. if test -f test1.txt -a "${1}" != "-c" ; then 
  2061.   echo shar: Will not over-write existing file \"test1.txt\"
  2062. else
  2063. echo shar: Extracting \"test1.txt\" \(6301 characters\)
  2064. sed "s/^X//" >test1.txt <<'END_OF_test1.txt'
  2065. XData may be passed to the procedure through value
  2066. Xparameters, and return values obtained through reference parameters.
  2067. XThe caller is suspended pending the return of the callee.  However,
  2068. Xinvocations differ from local procedure calls in several important
  2069. Xways.  The first, which is particular to Eden, is the requirement of
  2070. Xan accompanying capability to name to the target Eject.  Therefore,
  2071. Xthe Eject programmer is quite aware of the fact that an invocation is
  2072. Xnot "just another procedure call".  A second difference is
  2073. Xperformance.  Invocations will be far slower than a local procedure
  2074. Xcall simply because there is more going on.  The Eden kernel must
  2075. Xlocal the target Eject; network traffic may be necessary if the target
  2076. XEject is not on the same machine; parameters must be packaged into a
  2077. Xmessage to be sent to the target Eject; the target Eject must
  2078. Xunpackage the message and call the desired procedure with the
  2079. Xparameter values; the target Eject must package the results into a
  2080. Xmessage to be sent to the invoking Eject; finally, the invoking Eject
  2081. Xmust unpackage the results and return them to the calling procedure.
  2082. XIn light of such a performance deficit, Eject programmers may be
  2083. Xreluctant to structure a particular collection of Ejects in novel ways
  2084. Xin order to avoid the invocation overhead.
  2085. X
  2086. XThe thesis of this paper is to demonstrate that acceptable performance
  2087. Xfor invocations can be obtained in the Eden environment by paying
  2088. Xclose attention to the design and implementation of modules that
  2089. Xsupport remote procedure calls.  For the purposes of this thesis, the
  2090. Xscope will be limited to the Ejects' point of view.  The Eden kernel
  2091. Xwill not be considered.
  2092. X
  2093. X\section{Some Background}\label{introbck}
  2094. X
  2095. XEden has had a long history of improvements to its invocation
  2096. Xmechanism.  Previous work has concentrated on removing extraneous {\it
  2097. Xinter-process communication} (IPC) messages.  Particularly in Eden's
  2098. Xcase, IPC messages are very expensive.  Eden is built on top of Unix;
  2099. Xtherefore, each IPC message from an Eject to the Eden kernel, and vice
  2100. Xversa, involves at least a Unix process switch and copying the IPC
  2101. Xmessage into and out of the Unix kernel.
  2102. X
  2103. XThe first versions of Eden required 14 IPC messages to be sent per
  2104. Xlocal invocation.  A local invocation occurs when the invoking Eject
  2105. Xand the target Eject reside on the same physical machine.
  2106. XWhat was 2-process kernel's role in this setup?
  2107. X
  2108. XThe 2-process Eden kernel was finally replaced by a 1-process Eden
  2109. Xkernel, immediately reducing the number of messages required for an
  2110. Xinvocation by eliminating the IPC messages between the two kernel
  2111. Xprocesses.
  2112. X
  2113. XThe final reduction in IPC messages sent per invocation occurred
  2114. Xduring the summer of 1984.  Two more IPC messages were eliminated.
  2115. XOne of the messages eliminated was the IPC message from the Eden
  2116. Xkernel to the invoking Eject that communicated the {\it invocation
  2117. Xhandle} assigned to that particular call.  It was replaced by a scheme
  2118. Xwhere the invoking Eject was allowed to generate its own {\it local
  2119. Xinvocation handle} to communicate with the Eden kernel, and the Eden
  2120. Xkernel would generate its own unique handle in order to communicate
  2121. Xwith another Eden kernel or the target Eject.  The Eden kernel
  2122. Xguarantees that the reply message to an invocation will be stamped
  2123. Xwith the invoking Eject-generated handle.  The other IPC message
  2124. Xeliminated was the status message from the Eden kernel to the target
  2125. XEject confirming the kernel's approval of the reply message (format,
  2126. Xor contents if capabilities were contained in the reply).  The more
  2127. Xlogical scheme of notifying the invoking Eject of the failure status
  2128. Xof the reply, or the actual reply if the status was success, is now
  2129. Xbeing used.  The result of all these improvements is shown in figure
  2130. X\ref{oldfig}.  (See section \ref{oldexp} for an explanation of figure
  2131. X\ref{oldfig}.)
  2132. X
  2133. X\section{Related Work}\label{introrel}
  2134. X
  2135. XNelson's thesis thoroughly examines remote procedure calls.  He
  2136. Xstudies a number of implementations, and proposes a design for
  2137. XEmmisary(?), a new RPC mechanism with excellent transparency and
  2138. Xexceptional performance.  To attain exceptional performance, Nelson
  2139. Xgives a list of "lessons" that an RPC mechanism must have.  The
  2140. Xlessons are summarized here for the reader:
  2141. X
  2142. X\begin{itemize}
  2143. X\end{itemize}
  2144. X
  2145. XIn designing an RPC mechanism, it is convenient to use a layer model.
  2146. XHowever, strict adherance to the layer model often results in poor
  2147. Ximplementations.  There is a prohibitive cost associated with highly
  2148. Xmodular implementations that cannot be tolerated in RPC
  2149. Ximplementations.  In proposing a solution to the asynchrony
  2150. Xproblem, Cooper\cite{soft} advocates "soft layering".  The idea of soft
  2151. Xlayering may be applied to any naturally layered system whose layers
  2152. Xmust work well together.
  2153. X
  2154. X\section{Structure of Thesis}\label{introstruct}
  2155. X
  2156. XChapter \ref{old} examines the deficiencies of the current Eden
  2157. Xinvocation mechanism.  The reader is taken on a tour through the
  2158. Xprocess of initiating an invocation and receiving its reply, and
  2159. Xreceiving a new invocation and replying to the invocation.
  2160. X
  2161. XChapter \ref{new} proposes restructuring the dispatcher module for
  2162. Xsynchronous invocations (by far the most heavily used form of
  2163. Xcommunication within Eden) and breaking down the "hard layering" that
  2164. Xcurrently exists between the various layers that support invocations,
  2165. Xfrom the Eject's point of view, in order to obtain significant
  2166. Xperformance gains.
  2167. X
  2168. X\chapter{A Closer Look at the Eden Invocation Mechanism}\label{old}
  2169. X
  2170. X\section{The Dispatcher -- Interface and Internals}\label{olddis}
  2171. X
  2172. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{olddat}
  2173. X
  2174. X\section{Summary}\label{oldsum}
  2175. X
  2176. X\chapter{An Alternative Synchronous Invocation Mechanism}\label{new}
  2177. X
  2178. X\section{Assumptions and Limitations}\label{newass}
  2179. X
  2180. X\section{The Dispatcher -- Interface and Internals}\label{newdis}
  2181. X
  2182. X\section{A Word About Buffer Management}\label{newbuf}
  2183. X
  2184. X\section{Flow of Data -- CIP, Stub, and ESCII}\label{newdat}
  2185. X
  2186. X\section{Results and Timings}\label{newres}
  2187. X
  2188. X\section{Summary}\label{newsum}
  2189. X
  2190. X\chapter{Conclusions and Further Work}\label{concl}
  2191. X
  2192. X\section{Lessons Re-learned}\label{conles}
  2193. X
  2194. X\section{Soft Layering}\label{conlay}
  2195. X
  2196. X\section{Modularization and Interfaces}\label{conmod}
  2197. X
  2198. X\section{Further Work}\label{confur}
  2199. X
  2200. X\end{document}
  2201. X
  2202. END_OF_test1.txt
  2203. if test 6301 -ne `wc -c <test1.txt`; then
  2204.     echo shar: \"test1.txt\" unpacked with wrong size!
  2205. fi
  2206. # end of overwriting check
  2207. fi
  2208. if test -f window.h -a "${1}" != "-c" ; then 
  2209.   echo shar: Will not over-write existing file \"window.h\"
  2210. else
  2211. echo shar: Extracting \"window.h\" \(6063 characters\)
  2212. sed "s/^X//" >window.h <<'END_OF_window.h'
  2213. X/* 
  2214. X * Structure definitions for the window and keyboard routines.
  2215. X * The first half of this file contains structure declarations.
  2216. X * The second half contains functions, static variables, and
  2217. X * key value declarations.
  2218. X *
  2219. X * Robert W. Baldwin,  December 1984
  2220. X */
  2221. X
  2222. X
  2223. X/* Parameters */
  2224. X
  2225. X#define    MAXWIDTH    80        /* Max width of a display line. */
  2226. X#define    MAXHEIGHT    24        /* Max height of a window. */
  2227. X
  2228. X
  2229. X/* Key stroke handler structure.
  2230. X * The table is searched to find a key that matches the command typed
  2231. X * by the user.  The corresponding keyproc is then invoked.
  2232. X * The last entry in the table can have keychar == 0  or  -1.
  2233. X * If it is -1, that entry's corresponding
  2234. X * procedure is invoked with any characacter not previously matched.
  2235. X * If it is 0, then the table driver knows it should look at 
  2236. X * another table (if any).
  2237. X * See terminal.h and .c for more info on command keys.
  2238. X */
  2239. X
  2240. X#define    key    int        /* Command code in high byte, arg in low. */
  2241. X#define    keyer    struct xkeyer    /* Typically have a table of these. */
  2242. X
  2243. Xstruct    xkeyer    {
  2244. X    key    keychar;    /* Must be -1 or 0 for last entry in table. */
  2245. X    int    (*keyproc)();    /* Called with: window and key arg. */
  2246. X    };
  2247. X
  2248. X
  2249. X/* Common window definition. */
  2250. X
  2251. X#define zwindow \
  2252. X    int    worg_row;    /* Row and column of the upper lefthand corner */\
  2253. X    int    worg_col;    /* of this window in global screen coordinates */\
  2254. X    int    wheight;    /* Number of rows in window. */\
  2255. X    int    wwidth;        /* Number of columns. */\
  2256. X    int    wcur_row;    /* Location of cursor relative to the origin. */\
  2257. X    int    wcur_col;    /* Equals (1,1) if at window's origin. */\
  2258. X    char    *wprivate;    /* Ptr to window's private data. */\
  2259. X    int    (*wfirst)();    /* Called when cursor enters window. */\
  2260. X    int    (*wlast)();    /* Called after cursor leaves window. */\
  2261. X    int    (*wredraw)();    /* Called to redraw window over junk. */\
  2262. X    int    (*wkey)();    /* Called when key pressed and window is active*/\
  2263. X    keyer    *wkeyprocs    /* Procs that perform key stroke actions. */
  2264. X
  2265. X
  2266. X/* Specification of window procedures. */
  2267. X
  2268. X/* The follow declarations are assumed: gwindow *w;  key k;  keyer *ktab;
  2269. X * int    currow, curcol;  (cursor location in local coordinates).
  2270. X *
  2271. X * wfirst(w, currow, curcol)
  2272. X *    Called when cursor first enters window,
  2273. X *      Responsible for setting w->wcur_row, w->wcur_col to desired value.
  2274. X *      The display's cursor is already at the given coordinates.
  2275. X *
  2276. X * wlast(w)
  2277. X *    Called when the driving loop notices that the cursor is no longer
  2278. X *    in the currently active window.  Responsible for any cleanup needed
  2279. X *    before another window can become active.
  2280. X *
  2281. X * wredraw(w)
  2282. X *    Called to cleanup junk on the screen, usually at the user's request.
  2283. X *    The routine should set every character within its window.
  2284. X *      It should leave the cursor at some reasonable place, such as the
  2285. X *    place it last was within this window.
  2286. X *
  2287. X * wkey(w, k)
  2288. X *    Called when a key is pressed, and this window is active.
  2289. X *    Responsible for performing the desired action.  Sub-windows
  2290. X *    can assume that common keystrokes (like arrow movement) have
  2291. X *    already been handled.
  2292. X */
  2293. X
  2294. X/* General purpose window. */
  2295. X
  2296. X#define    gwindow        struct    xgwindow
  2297. X
  2298. Xstruct     xgwindow    {
  2299. X    zwindow;
  2300. X    };
  2301. X
  2302. X
  2303. X/* Display line for fixed and editable strings. */
  2304. X
  2305. X#define    displine    struct    xdispline
  2306. X
  2307. Xstruct    xdispline    {
  2308. X    zwindow;
  2309. X    int    dl_min_col;    /* Min location of cursor relative to origin */
  2310. X    int    dl_max_col;    /* Max location of cursor relative to origin */
  2311. X    int    dl_length;    /* Last non-blank column in line. */
  2312. X    char    dl_chars[MAXWIDTH+1];    /* Null terminated string whose len */
  2313. X                    /*  always == the width of the line. */
  2314. X    };
  2315. X
  2316. X
  2317. X/* Window containing changeable lines of text. */
  2318. X
  2319. X#define    twindow        struct    xtwindow
  2320. X
  2321. Xstruct    xtwindow    {
  2322. X    zwindow;
  2323. X    displine    **dlines;    /* Null terminated array of lines. */
  2324. X    };
  2325. X
  2326. X
  2327. X/* Procedures from windowlib.c */
  2328. X
  2329. Xextern    int    wl_driver(/* wtab */);    /* Run window system. */
  2330. Xextern    int    wl_refresh(/* wtab */);    /* Redraw all windows. */
  2331. Xextern    int    wl_rcursor(/* w */);    /* Restore old cursor position. */
  2332. Xextern    int    wl_setcur(/* w, row, col */);    /* Set cursor relative. */
  2333. Xextern    int    wl_noop(/* w */);    /* Do nothing. */
  2334. Xextern    int    wl_hascur(/* w */);    /* Return TRUE if cursor in window. */
  2335. Xextern    int    wl_draw(/* w */);    /* Invoke window's redraw routine. */
  2336. Xextern    int    wl_twdraw(/* w */);    /* Redraw for twindow. */
  2337. Xextern    int    wl_dldraw(/* w */);    /* Redraw for displine. */
  2338. Xextern    wl_dlleft(/* w */), wl_dlright(/* w */);
  2339. Xextern    wl_dlfdel(/* w */), wl_dlbdel(/* w */), wl_dlclr(/* w */);
  2340. Xextern    wl_dlinsert(/* w, k */);
  2341. Xextern    wl_dlgetvar(/* w, buf */);    /* Fill buf with variable part. */
  2342. Xextern    wl_dlsetvar(/* w, str */);    /* Set variable part from string. */
  2343. Xextern    wl_nxtarg(/* line */);        /* Adv to next %. */
  2344. Xextern    int    clrdline(/* dl */);    /* Blankout all chars in displine. */
  2345. Xextern    int    setdline(/* dl */);    /* Set first chars of displine. */
  2346. Xextern    int    wl_erase(/* w */);    /* Blank out a window. */
  2347. Xextern    int    wl_outline(/* w */);    /* Outline w/o changing insides. */
  2348. Xextern    int    key2graphic(/* c */);    /* Returns key to represent char c. */
  2349. X
  2350. X
  2351. X/* Procedures from keylib.c */
  2352. Xextern    int    getkey();        /* Get a key stroke from the user. */
  2353. Xextern    int    dokey(/* w, k */);    /* Invokes window's keyproc for k. */
  2354. Xextern    int    ddokey(/* w,k,ktab */);    /* Invokes keyproc for k found in ktab. */
  2355. Xextern    int    noopkey(/* w, k */);    /* A do-nothing keyproc. */
  2356. X
  2357. X
  2358. X/* These four routines move the cursor and if it is still within
  2359. X * the window, w, they update the window's cursor position field.
  2360. X * They can be used as keyprocs.
  2361. X */
  2362. Xextern    int    jogleft(/* w, k */);
  2363. Xextern    int    jogright(/* w, k */);
  2364. Xextern    int    jogup(/* w, k */);
  2365. Xextern    int    jogdown(/* w, k */);
  2366. X
  2367. X
  2368. X/* Static variables from keylib.c */
  2369. X
  2370. Xextern    keyer    arwktab[];        /* Default key table for arrow keys. */
  2371. X                    /* They call the correct jog routine */
  2372. X
  2373. X
  2374. X
  2375. X/* ASCII character definitions
  2376. X */
  2377. X#define    CNTRL        037
  2378. X#define CTRL_P        (CNTRL & 'P')
  2379. X#define CTRL_N        (CNTRL & 'N')
  2380. X#define CTRL_B        (CNTRL & 'B')
  2381. X#define CTRL_F        (CNTRL & 'F')
  2382. X#define CTRL_C        (CNTRL & 'C')   /* added by slg */
  2383. X#define    RETURN        (CNTRL & 'M')
  2384. X#define    LINEFEED    (CNTRL & 'J')
  2385. X#define    TAB        (CNTRL & 'I')
  2386. X#define    SPACE        (' ')
  2387. X
  2388. END_OF_window.h
  2389. if test 6063 -ne `wc -c <window.h`; then
  2390.     echo shar: \"window.h\" unpacked with wrong size!
  2391. fi
  2392. # end of overwriting check
  2393. fi
  2394. echo shar: End of archive 3 \(of 11\).
  2395. cp /dev/null ark3isdone
  2396. MISSING=""
  2397. for I in 1 2 3 4 5 6 7 8 9 10 11 ; do
  2398.     if test ! -f ark${I}isdone ; then
  2399.     MISSING="${MISSING} ${I}"
  2400.     fi
  2401. done
  2402. if test "${MISSING}" = "" ; then
  2403.     echo You have unpacked all 11 archives.
  2404.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2405. else
  2406.     echo You still need to unpack the following archives:
  2407.     echo "        " ${MISSING}
  2408. fi
  2409. ##  End of shell archive.
  2410. exit 0
  2411.  
  2412. -- 
  2413. Rich $alz            rsalz@pineapple.bbn.com
  2414. Cronus Project, BBN Labs    "Anger is an energy"
  2415.